package demop1;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        MyArrayList myArrayList=new MyArrayList();
        myArrayList.add(10);
        myArrayList.add(20);
        myArrayList.add(30);
        myArrayList.add(40);
        myArrayList.add(50);
        myArrayList.display();
        System.out.println();
        System.out.println("========新增元素，默认在最后一位插入=========");
        myArrayList.add(3,33);
        myArrayList.add(3,44);
        myArrayList.add(7,77);
        myArrayList.display();
        System.out.println();
        System.out.println("========在指定位置插入元素=========");
        System.out.println(myArrayList.contains(44));
        System.out.println(myArrayList.contains(77));
        System.out.println("=========判断是否包含某个元素========");
        System.out.println(myArrayList.indexOf(40));
        System.out.println(myArrayList.indexOf(8));
        System.out.println("========查找指定元素下标=========");
        System.out.println(myArrayList.get(6));
        //System.out.println(myArrayList.get(10));
        System.out.println("========获取指定位置元素的值=========");
        myArrayList.set(4,55);
        myArrayList.display();
        System.out.println();
        System.out.println("========改变pos位置的值=========");
        myArrayList.remove(44);
        myArrayList.remove(49);
        myArrayList.display();
        System.out.println();
        System.out.println("=========删除某个数据元素=========");
        System.out.println(myArrayList.size());
        System.out.println("========获取顺序表长度");
        myArrayList.clear();
        myArrayList.display();
    }
}
